/*
 * Copyright (c) GoKeep by gokeep.org. 2022-2023. All rights reserved
 */
package org.gokeep.communication.event.impl;

import com.google.protobuf.ByteString;
import jakarta.annotation.Resource;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.gokeep.communication.event.Event;
import org.gokeep.communication.proto.CommandProto;
import org.gokeep.communication.proto.MessageProto;
import org.gokeep.communication.proto.RelationRequestProto;
import org.gokeep.communication.service.UserService;
import org.smartboot.socket.transport.AioSession;
import org.springframework.stereotype.Component;


@Slf4j
@Component
public class FetchUserListEvent extends Event {

    @Resource
    private UserService userService;

    @SneakyThrows
    @Override
    public void process(AioSession session, MessageProto.Message message) {
        ByteString bytes = message.getData();
        RelationRequestProto.UserListRequest request = RelationRequestProto.UserListRequest.parseFrom(bytes);
        log.info("Fetch user list params is: {}", request);
    }

    @Override
    protected CommandProto.CommandEnum getEventType() {
        return CommandProto.CommandEnum.USER_LIST_REQUEST;
    }
}
